
export default (app, options) => {
	
	if (process.env.UNI_PLATFORM  == "app") {
		console.log('=== Urovo PDA 扫码插件初始化 ===');
		const main = plus.android.runtimeMainActivity();//获取activity
		var IntentFilter = plus.android.importClass('android.content.IntentFilter');
		const filter = new IntentFilter();
		filter.addAction("android.intent.ACTION_DECODE_DATA"); // 换你的广播动作  (设置-扫描设置-输出方式-输出方式改为Intent输出) 
		console.log('已注册广播动作: android.intent.ACTION_DECODE_DATA');
		const receiver = plus.android.implements('io.dcloud.android.content.BroadcastReceiver', {
			onReceive: function (context, intent : any) {
				console.log('PDA 广播接收器触发');
				plus.android.importClass(intent);
				let code = intent.getStringExtra("barcode_string");// 换你的广播标签
				console.log('接收到扫码数据:', code);
				uni.$emit("urovo", code);
				console.log('已发送 urovo 事件');
			}
		});
		main.registerReceiver(receiver, filter);
		console.log('PDA 扫码广播接收器注册完成');
	} else {
		console.log('当前不是 APP 平台，跳过 PDA 扫码插件初始化');
	}
}